grammar mini1;

compUnit: funcDef;
funcDef: FuncType Ident '(' ')' block;
block: '{' stmt '}';
stmt: 'return' number ';';

number: decimalconst | octalconst | hexadecimalconst;

decimalconst: Decimalconst;

octalconst: Octalconst;

hexadecimalconst: Hexadecimalconst;


FuncType: 'int';
Ident: 'main';

Decimalconst: [1-9] [0-9]*;
Octalconst: '0' [0-7]*;
Hexadecimalconst:('0x' | '0X') [0-9a-zA-F]+;

LINECOMMENT: '//' ~[\r\n]* '\r'? '\n'?  -> skip;
SLCOMMENT:'/*' .*? '*/' -> skip;
SPACE: [ \t\r\n] -> skip;